package com.ymatou.iapi.godmch.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.godmch.parameter.createIndepMchBean;
import com.ymatou.iapi.godmch.parameter.editmchBean;
import com.ymatou.iapi.godmch.parameter.getAgentPromotePicBean;
import com.ymatou.iapi.godmch.service.applyAgentCall;
import com.ymatou.iapi.godmch.service.createIndepMchCall;
import com.ymatou.iapi.godmch.service.getAgentPromotePicCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.invite_code;
import com.ymttest.database.sqlwapper.godmch.invite_codeWapper;
/**
*获取代理推广商邀请图片
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_getAgentPromotePic{
	private static getAgentPromotePicBean bean;
	private static getAgentPromotePicCall call;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取代理推广商邀请图片");
	}

	@Before
	public void caseUp() {
		bean=new getAgentPromotePicBean();
		call=new getAgentPromotePicCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_getAgentPromotePic_001() {
		Logger.start(true,"获取代理推广商邀请图片");
		try {
			
//			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
//            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
//            Integer mchId=createIndepMchCall.getmchId();
//            applyAgentCall applyAgent =GodmchManageCallService.applyAndapproveAgent(mchId);
//            
//            editmchBean editmchBean=GodmchManageCallService.IniteditmachBean(applyAgent.getAgentId());
//            GodmchManageCallService.editmachCall(editmchBean);
			Integer mchId=501371929;
			Integer agentId=501371931;
            bean.setMchId(agentId);
			call.setData(bean);
			call.callService();			
			Logger.verifyEquals("200", call.getStatusCode1(), "验证status");
			invite_codeWapper codeWapper=new invite_codeWapper();
			invite_code invite_Code=codeWapper.selectByCode(call.getInviteCode());
			Logger.verifyEquals(call.getInviteCode(), invite_Code.getInviteCode(), "验证InviteCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_getAgentPromotePic_002() {
		Logger.start(true,"获取代理推广商邀请图片-验证非独立云平台禁用代理推广功能");
		try {

            bean.setMchId(501372061);
			call.setData(bean);
			call.callService();			
			Logger.verifyEquals("500", call.getStatusCode1(), "验证status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}